package com.exercise.DesignPattern.BehavioralPatterns.IteratorPattern;

import java.util.List;

//具体迭代器
public class ConcreteIterator implements Iterator{

    private final List<Object> list;
    private int size;

    public ConcreteIterator(List<Object> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        return size < list.size();
    }

    @Override
    public Object next() {
        return list.get(size++);
    }
}
